﻿@using CMSMVC4.MultiResource
@model CMSMVC4.Areas.Admin.Models.GioiThieuModel
@{
    ViewBag.Title = @Admin.Introduction;
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@using (Ajax.BeginForm("Index", "GioiThieu", null, new AjaxOptions() { HttpMethod = "Post", OnBegin = "begin()", OnSuccess = "end(data)" }, new { @id = "form", name = "form", @class = "form-horizontal cmxform" }))
{ 
    <div class="row-fluid">
        <div class="span7" style="width: 100%">
            <div class="box paint color_2">
                <div class="title">
                    <h4>
                        <span>@Admin.Introduction</span>
                    </h4>
                </div>
                <div class="form-row control-group row-fluid">
                    <span id="mess" style="padding-left: 15px">@Html.ValidationSummary()</span>
                </div>
                <div class="content">
                    <div class="accordion" id="accordion4">
                        <div class="accordion-group">
                            <div class="accordion-heading">
                                <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion4"
                                    href="#collapseOne2">@Admin.Content</a></div>
                            <div id="collapseOne2" class="accordion-body collapse in">
                                <div class="accordion-inner">
                                    <ul id="tabExample1" class="nav nav-tabs">
                                        <li class="active"><a href="#Vi" data-toggle="tab">@Admin.Vietnamese</a></li>
                                        <li><a href="#En" data-toggle="tab">@Admin.English</a></li>
                                    </ul>
                                    <div class="tab-content">
                                        <div class="tab-pane fade in active" id="Vi">
                                            @Html.TextAreaFor(x => x.fullv)
                                        </div>
                                        <div class="tab-pane fade" id="En">
                                            @Html.TextAreaFor(x => x.fulle)
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="accordion-group">
                            <div class="accordion-heading">
                                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion4" href="#collapseTwo2">@Admin.Summary</a></div>
                            <div id="collapseTwo2" class="accordion-body collapse" style="height: 0px;">
                                <div class="accordion-inner">
                                    <ul id="tabExample2" class="nav nav-tabs">
                                        <li class="active"><a href="#Vi1" data-toggle="tab">@Admin.Vietnamese</a></li>
                                        <li><a href="#En1" data-toggle="tab">@Admin.English</a></li>
                                    </ul>
                                    <div class="tab-content">
                                        <div class="tab-pane fade in active" id="Vi1">
                                            @Html.TextAreaFor(x => x.sumv)
                                        </div>
                                        <div class="tab-pane fade" id="En1">
                                            @Html.TextAreaFor(x => x.sume)
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-actions row-fluid">
                        <div class="span7 offset3">
                            <button type="submit" class="btn btn-primary">@Admin.SaveChange</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    @Html.HiddenFor(x => x.Pageidv) @Html.HiddenFor(x => x.Pageide) <br />
}
@* ReSharper disable UnusedLocals *@
<script type="text/javascript">
    var editor;
    function createEditor(languageCode, id) {
        var editor = CKEDITOR.replace(id, {
            language: languageCode
        });
    }

    $(function () {
        createEditor('@ViewBag.l', 'fullv');
        createEditor('@ViewBag.l', 'fulle');
        createEditor('@ViewBag.l', 'sumv');
        createEditor('@ViewBag.l', 'sume');
    });
</script>

<script language="javascript" type="text/javascript">
    function luu() {
        //-----------------
        $('#loading').fadeIn();
        $.ajax({
            type: "Post",
            dataType: "json",
            url: "/Admin/GioiThieu/Index",
            data: $('#form').serialize(),
            success: function (data) {
                $('#mess').fadeIn(0);
                $('#mess').text(data);
                $('#loading').fadeOut();
                $('#mess').delay(5000).fadeOut(1000);
            }
        });
    }
    function begin() {
        $('#loading').fadeIn();
    }
    function end(data) {
        $('#mess').fadeIn(0);
        $('#mess').text(data);
        $('#loading').fadeOut();
        $('#mess').delay(5000).fadeOut(1000);
    }
    $(function () {
        var saved = setInterval("luu()", 180000);
    });
</script>